#include "com.hpp"

int main()
{
    int shmid = getshmflg();
    char *shmaddr = (char *)shmat(shmid, nullptr, 0);

    int fd = open(FIFO_FILE, O_WRONLY);
    if (fd == -1)
    {
        perror("open");
        exit(OPEN_ERROR);
    }

    while (true)
    {
        cout << "A sends a message to B:";
        fgets(shmaddr, size, stdin);
        write(fd, "c", 1);
    }

    shmdt(shmaddr);
    close(fd);
    return 0;
}